package com.mars.common.convert;

import com.google.common.collect.Lists;

import java.util.List;

/**
 * @author rplees
 * @email rplees.i.ly@gmail.com
 * @version 1.0
 * @created Jan 6, 2021 4:37:30 PM
 */
public interface IEntityPOConvert<E, P> {
	E toEntity(P d);

	P toPo(E e);

	default List<E> toEntity(List<P> d) {
		return Lists.transform(d, v -> toEntity(v));
	}

	default List<P> toPo(List<E> e) {
		return Lists.transform(e, v -> toPo(v));
	}
}
